<?php

namespace app\Api\model;

use think\Loader;
use think\Db;
use app\common\model\Orders as cOrders;

class Orders extends cOrders
{
    protected $pagesize = 10;//列表分页大小

    protected $type               = [
            'rent_contact_id' => 'array'
    ];

    public function caravan()
    {
        return $this->belongsTo('\\app\\common\\model\\Caravans','caravan_id');
    }
    public function getOrders($querys = [])
    {
        $status = [
            '01'  => '等待支付',
            '10'  => '继续支付',
            '11'  => '已支付订单',
            '20'  => '订单退款中',
            '21'  => '已退款订单',
            '31'  => '订单完成',
            '41'  => '已取消订单',
            '50'  => '入住中'
        ];
        $lists =  $this->getInfoList($querys,'caravan');
        foreach ($lists as $list) {
            $list->ordertype = $status[$list->stage.$list->status];
        }
        return $lists;
    }
    /**
     * 列表
     * @param  array   $querys [description]
     * @return [type]          [description]
     */
    // public function getInfoList($querys = [], $with = null, $order = 'id desc')
    // {
    //     if ($with && is_string($with) && strpos($with, ' ')) {
    //         $order = $with;
    //         $with = null;
    //     }
        
    //     return $this->where($this->setInfoListQuery($querys))->order($order)->with($with)->select();
    // }
}
